<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.console.servlets.financial.cz.CzWdz"%>
<%@page import="com.blockchain.console.servlets.financial.cz.CzRgqr"%>
<%@page import="com.blockchain.console.servlets.financial.cz.ExportCzgl"%>
<%@page import="com.blockchain.common.enums.IsPass"%>
<%@page import="com.blockchain.common.enums.ChargeType"%>
<%@page import="com.blockchain.console.servlets.financial.AbstractFinancialServlet"%>
<%@page import="com.blockchain.console.servlets.financial.cz.CzglList"%>
<%@page import="com.blockchain.console.service.financial.entity.CzglRecord"%>
<%@page import="com.blockchain.common.enums.ChargeStatus"%>
<%@page import="java.text.DecimalFormat"%>

<html>
<head>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
</head>
<%
		CURRENT_CATEGORY = "CWGL";
		CURRENT_SUB_CATEGORY = "RMBCZ";
		PagingResult<CzglRecord> result = (PagingResult<CzglRecord>) request.getAttribute("result");
%>
<body>
	<%@include file="/WEB-INF/include/header.jsp"%>
	<div class="w_main">
		<div class="main clearfix">
			<div class="wrap">
				<div class="r_main">
					<div class="home_main">
						<form action="<%controller.getURI(request, CzglList.class);%>" method="post" name="form1" id="searchForm">
							<div class="box box1 mb15">
								<div class="atil">
									<h3>人民币充值</h3>
								</div>
							</div>
							<div class="box box1 mb15">
								<div class="con">
									<div class="admin_input admin_pb">
             							<div class="table top3">
											<p>
												<span>用户ID：</span>
												<input type="text" name="userid" value="<%StringHelper.filterHTML(out, request.getParameter("userid")); %>" class="yhgl_input" />
											</p>
											<p>
												<span>姓名：</span>
												<input type="text" name="name" value="<%StringHelper.filterHTML(out, request.getParameter("name")); %>" class="yhgl_input" />
											</p>
											<p>
												<span>卡号：</span>
												<input type="text" name="kh" value="<%StringHelper.filterHTML(out, request.getParameter("kh")); %>" class="yhgl_input" />
											</p>
											<P>
												<span>充值时间：</span>
												<input type="text" name="startRechargeTime" id="datepicker1" readonly="readonly" class="yhgl_input date" />至
												<input type="text" name="endRechargeTime" id="datepicker2" readonly="readonly" class="yhgl_input date" />
											</P>
											<p>
												<span>充值方式：</span>
												<select name="payType" class="yhgl_sel" >
														<option>请选择</option>
														<%
															for (ChargeType payType : ChargeType.values()) {
														%>
														<option value="<%=payType.name()%>" <%if (payType.name().equals(request.getParameter("payType"))){%> selected="selected" <%} %>><%=payType.getName()%></option>
														<%
															}
														%>
												</select>
											</p>
											<P>
												<span>充值状态：</span>
												<select name="status" class="yhgl_sel" >
														<option>请选择</option>
														<%
															for (ChargeStatus status : ChargeStatus.values()) {
														%>
														<option value="<%=status.name()%>" <%if (status.name().equals(request.getParameter("status"))){%> selected="selected" <%} %>><%=status.getName()%></option>
														<%
															}
														%>
												</select>
											</P>
											<P>
												<span>是否自动到账：</span>
												<select name="is" class="yhgl_sel" >
														<option>请选择</option>
														<%
															for (IsPass is : IsPass.values()) {
														%>
														<option value="<%=is.name()%>" <%if (is.name().equals(request.getParameter("is"))){%> selected="selected" <%} %>><%=is.getName()%></option>
														<%
															}
														%>
												</select>
											</P>
												<div class="mt10">   
												<input name="search" type="submit" class="btn2 mr10" value="搜索" />
												<%
													if (blockchainSession.isAccessableResource(ExportCzgl.class)) {
														%>
														<a href="javascript:void(0)" onclick="showExport()" class="btn3 mr10"><span class="ico"></span>导出</a>
														<%}else{ %>
														<span class="btn3 btn5 mr10"><span class="ico"></span>导出</span>
												<%} %> 
											</div>
									<div class="clear"></div>
								</div>
								</div>
								</div>
							</div>
							<table width="100%" border="0" cellspacing="0" cellpadding="3" class="yhgl_table tc">
								<tr class="hsbg">
									<td>序号</td>
									<td>用户ID</td>
									<td>用户名</td>
									<td>姓名</td>
									<td>银行卡号</td>
									<td>充值金额(CNY)</td>
									<td>实际到账(USDZ)</td>
									<td>充值方式</td>
									<td>充值状态</td>
									<td>是否自动到账</td>
									<td>充值时间</td>
									<td>操作人</td>
									<td>操作</td>
									
								</tr>
								<%
									CzglRecord[] items = result.getItems();
										if (items != null) {
											int i=1;
											for (CzglRecord rechargeItem : items) {
												if (rechargeItem == null) {
													continue;
												}
								%>
								<tr class="dhsbg">
									<td><%=rechargeItem.id%></td>
									<td><%=rechargeItem.userid%></td>
									<td><%StringHelper.filterHTML(out, rechargeItem.loginName);%></td>
									<td><%StringHelper.filterHTML(out, rechargeItem.userName);%></td>
									<td><%StringHelper.filterHTML(out, rechargeItem.czkh);%></td>
									<td><%=Formater.formatAmount(rechargeItem.tjjeAmount)%></td>
									<td><%=Formater.formatAmount(rechargeItem.cny)%></td>
									<td><%if(rechargeItem.chargeType!=null){%><%=rechargeItem.chargeType.getName()%><%}%></td>
									<td><%if(rechargeItem.rechargeStatus!=null){%><%StringHelper.filterHTML(out,rechargeItem.rechargeStatus.getName());%><%}%></td>
									<td><%=rechargeItem.is.getName()%></td>
									<td><%=DateTimeParser.format(rechargeItem.chargeDateTime,"yyyy-MM-dd HH:mm")%></td>
									<td><%=rechargeItem.approver%></td>
									<td>
									<%if (blockchainSession.isAccessableResource(CzRgqr.class)&rechargeItem.is.name().equals(IsPass.F.toString())&rechargeItem.rechargeStatus.name().equals(ChargeStatus.CLZ.toString())) {%>
                          			<span class="blue"><a onclick="cz('<%=rechargeItem.id%>','<%=rechargeItem.userid%>','<%=rechargeItem.cny%>')"  href="javascript:void" class="mr10">确认到账</a></span>
                          			<%}%>
                          			<%if (blockchainSession.isAccessableResource(CzWdz.class)&rechargeItem.rechargeStatus.name().equals(ChargeStatus.CLZ.name())&&rechargeItem.is==IsPass.F) {%>
                          			<span class="blue"><a onclick="load1('<%=controller.getURI(request, CzWdz.class)%>?id=<%=rechargeItem.id%>')"  href="javascript:void" class="mr10">未支付</a></span>
                          			<%}%>
									</td>
								</tr>
								<%}}%>
							</table>
							<%
							AbstractFinancialServlet.rendPagingResult(out, result);
							%>
							<div class="box2 clearfix"></div>
						</form>
					</div>
				</div>
			</div>
			<%@include file="/WEB-INF/include/left.jsp"%>
		</div>
	</div>
	
					<div id="cz" style="display: none">
					<div class="popup_bg"></div>
						<div class="w440 thickbox thickpos" style="margin:-80px 0 0 -220px;" id="showDiv">
					      <div class="info clearfix">
					      	  <div class="clear"></div>
						      <form action="<%=controller.getURI(request, CzRgqr.class)%>" method="post" class="form2" id="form2">
						      <input name="id" type="hidden" id="id">
						      <input name="userid" type="hidden" id="userid">
					      			<div class="tit" style="margin-left: 40px;">
							        	 <span class="fl pl15 red">充值金额:<input style="background:transparent; color:#f0335d!important; font-size: 16px;"
							        	  name="sjdzje" disabled="disabled" type="text" id="czje"></input></span>
							      	</div>	
									<div class="tc w220 pt20">
										<input type="button"  onclick="load()"  style="cursor: pointer;" value="提交"  class="btn3 mr30 sumbitForme" fromname="form2" /> 
										<input type="button"  name="button2" onclick="$('#cz').hide()" value="取消" class="btn5" />
									</div>
								</form>
					      </div>
						</div>
					</div>
					<input type="hidden" id="msg" value="<%StringHelper.filterHTML(out,(String)request.getAttribute("message"));%>">
	
	<%@include file="/WEB-INF/include/footer.jsp"%>
	<%@include file="/WEB-INF/include/script.jsp"%>
	<%@include file="/WEB-INF/include/datepicker.jsp"%>
	<script type="text/javascript"src="<%=controller.getStaticPath(request)%>/js/validation.js"></script>
	<script type="text/javascript">
	$(function() {
		$("#datepicker1").datepicker({inline: true});
	    $('#datepicker1').datepicker('option', {dateFormat:'yy-mm-dd'});
	    $("#datepicker2").datepicker({inline: true});
	    $('#datepicker2').datepicker('option', {dateFormat:'yy-mm-dd'});
	    $("#datepicker1").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("startRechargeTime"));%>");
	    $("#datepicker2").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("endRechargeTime"));%>");
	});
	function showExport()
	{
		document.getElementById("searchForm").action ="<%=controller.getURI(request, ExportCzgl.class)%>";
		$("#searchForm").submit();
		document.getElementById("searchForm").action ="<%=controller.getURI(request, CzglList.class)%>";
	}
	
	function cz(id,userid,tjje){
		$("#cz").show();
		$("#czje").val(tjje);
		$("#id").val(id);
		$("#userid").val(userid);	
	}
	
	function load()
	{
		var cz=$("#c").html();
		if(cz>=1||cz<0){
		if (!window.confirm("你确定吗？")) {
			return;
		}
		}
		$("#form2").submit();
	}
	
	function load1(url)
	{
		if (!window.confirm("你确定吗？")) {
			return;
		}
		location.href=url;
	}	
	</script>
</body>
</html>
